// observer 观察者模式
var readline = require('readline')
var fs = require('fs')

var rl = readline.createInterface({
  input: fs.createReadStream('./data/file1.txt')
})

var lineNum = 0
rl.on('line', function () {
  lineNum++
})

rl.on('close', function () {
  console.log('lineNum', lineNum)
})